﻿@model PagedList.IPagedList<TaoNiuOA.Models.Performance>
@using PagedList
@{
    ViewBag.Title = "我的绩效";
    Layout = "~/Views/Shared/_AdminLayout.cshtml";
}
<fieldset>
    <legend>我的绩效</legend>
    <div>
        <ul>
            <li><a href="?mod=thismonth">本月</a></li>
            <li><a href="?mod=lastmonth">上个月</a></li>
            <li><a href="?mod=all">所有绩效</a></li>
        </ul>
    </div>
    <div>
        <form id="form1">
        <script src="../../Plusins/timeplus/WdatePicker.js" type="text/javascript"></script>
        <input type="text" id="searchTime" name="searchTime" onfocus="WdatePicker({dateFmt:'yyyy-MM'})"
            class="Wdate" />
        <input type="button" id="btnSearch" name="btnSearch" value="查询" />
        </form>
    </div>
    <table>
        <tr>
            <th>
                考核名称
            </th>
            <th>
                考核用户
            </th>
            <th>
                考核月份
            </th>
            <th>
                应得绩效
            </th>
            <th>
                主管评分
            </th>
            <th>
                实得绩效
            </th>
            <th>
                状态
            </th>
            <th>
                最后更新
            </th>
        </tr>
        @foreach (var item in Model)
        {
            <tr>
                <td>
                    @Html.DisplayFor(modelItem => item.Title)
                </td>
                <td>
                    @item.GetUser().GetUserInfo().Name
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Month)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.TotalPoint)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.AdminPoint)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.PayPoint)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Status)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.LastUpdate)
                </td>
            </tr>
        }
    </table>
    <br />
    <div>@ViewData["statInfo"]</div>
    <div style="width: auto; height: 30px; margin-top: 20px; text-align: center;">
        @(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber)
        / @Model.PageCount
        &nbsp;
        @if (Model.HasPreviousPage)
        {
            @Html.ActionLink("首页", ViewData["actionName"].ToString(), new { mod = ViewData["mod"], page = 1, currentFilter = ViewBag.CurrentFilter })
            @Html.Raw("&nbsp;");
            @Html.ActionLink(" 上一页", ViewData["actionName"].ToString(), new { mod = ViewData["mod"], page = Model.PageNumber - 1, currentFilter = ViewBag.CurrentFilter })
        }
        else
        {
            @Html.Raw("首页&nbsp;&nbsp;上一页")
        }
        &nbsp;
        @if (Model.HasNextPage)
        {
            @Html.ActionLink("下一页 ", ViewData["actionName"].ToString(), new { mod = ViewData["mod"], page = Model.PageNumber + 1, currentFilter = ViewBag.CurrentFilter })
            @Html.Raw("&nbsp;");
            @Html.ActionLink("尾页", ViewData["actionName"].ToString(), new { mod = ViewData["mod"], page = Model.PageCount, currentFilter = ViewBag.CurrentFilter })
        }
        else
        {
            @Html.Raw("下一页&nbsp;&nbsp;尾页")
        }
    </div>
</fieldset>
<script type="text/javascript">
    var btn = document.getElementById("btnSearch");
    var frm = document.getElementById("form1");
    var search = document.getElementById("searchTime");
    btn.onclick = function () {
        if (che()) {
            frm.method = "post";
            frm.action = "?mod=" + search.value;
            frm.submit();
        }
    }
    function che() {
        if (search.value == "") {
            alert("请选择时间");
            return false;
        }
        return true;
    }
</script>
